package bean;

import java.util.ArrayList;

/**
 * Bean object for storage of items from the table Users within the Database, contains getters and setters.
 * 
 *  @author Sander Meijer & Stijn Kliemesch
 *  
 */
public class UserBean {

	private int 						userID;
	private String 						userName;
	private String 						password;
	private ArrayList<AuctionItemBean>	auctions;
	private ArrayList<BidBean>			bids;
	
	/**
	 * <b>Constructor</b></br>
	 * Creates an empty {@link UserBean}
	 */
	public UserBean() {
		auctions	= new ArrayList<AuctionItemBean>();
		bids 		= new ArrayList<BidBean>();
	}
	
	/**
	 * <b>Constructor</b></br>
	 * Creates a {@link UserBean} with the following parameters and without the lists.
	 * @param the_userID int
	 * @param the_userName String
	 * @param the_password String
	 */
	public UserBean(int the_userID, String the_userName, String the_password) {
		userID		= the_userID;
		userName	= the_userName;
		password	= the_password;
		auctions	= new ArrayList<AuctionItemBean>();
		bids 		= new ArrayList<BidBean>();
	}
	
	/**
	 * <b>Constructor</b></br>
	 * Creates a {@link UserBean} with the following parameters, including lists.
	 * @param the_userID int
	 * @param the_userName String
	 * @param the_password String
	 * @param the_auctions Arraylist {@link AuctionItemBean}
	 * @param the_bids ArrayList {@link BidBean}
	 */
	public UserBean(
			int 				the_userID,		String 						the_userName, 
			String 				the_password,	ArrayList<AuctionItemBean>	the_auctions,
			ArrayList<BidBean>	the_bids) {
		userID		= the_userID;
		userName	= the_userName;
		password	= the_password;
		auctions	= the_auctions;
		bids 		= the_bids;
	}

	public int 							getUserID()		{ return userID; 	}
	public String 						getUserName()	{ return userName;	}
	public String 						getPassword()	{ return password;	}
	public ArrayList<AuctionItemBean>	getAuctions()	{ return auctions;	}
	public ArrayList<BidBean>			getBids()		{ return bids;		}
	
	public void setUserID		(int 						userID) 	{ this.userID 	= userID;	}
	public void setUserName		(String 					userName) 	{ this.userName = userName;	}
	public void setPassword		(String 					password) 	{ this.password	= password;	}
	public void setAuctions		(ArrayList<AuctionItemBean>	auctions)	{ this.auctions	= auctions;	}
	public void setBids			(ArrayList<BidBean> 		bids) 		{ this.bids 	= bids;		}
	
	/**
	 * ToString method, returns a string with all the information within this {@link UserBean}
	 * @return String
	 */
	public String toString(){
		String retString = "UserID: " + userID + " username: " + userID + " password: " + password + "\nauctions";
		
		for(AuctionItemBean aib : auctions){
			retString += "\n\t" + aib.toString();
		}
		retString += "\nbids";
		for(BidBean bb : bids){
			retString += "\n\t" + bb.toString();
		}
		
		return retString;
	}
}
